package com.weipai.springboot.module.mapper;

import com.weipai.springboot.model.DemandCategory;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;
import java.util.Map;

/**
 * 需求类别
 */
public interface DemandCategoryMapper extends Mapper<DemandCategory>, MySqlMapper<DemandCategory>{

    //查询需求类别详情
    DemandCategory getDemandCategoryById(String demandCategoryId);

    //分页查询
    List<DemandCategory> selectAllByDemandCategoryDel(@Param("del") int demandCategoryDel, @Param("search") String search,
                                                      @Param("sort") String sort, @Param("way") String way);

    //更改需求类别的状态
    @Update("update c_demand_category set demand_category_status=#{status}, update_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where demand_category_id=#{id}")
    int updateStatus(@Param("id") String demandCategoryId, @Param("status") Integer status);

    //批量删除
    int batchDeleteById(String[] id);

    //获取需求分类
    List<Map<String,Object>> getDemandCategory();
}